package org.example.transation;


import org.example.cache.AssetType;
import org.example.cache.AssetTypeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

@Service
public class SpringTransactionC {

    @Autowired
    AssetTypeMapper assetTypeMapper;

//    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void cMethod() {
        AssetType assetType = new AssetType();
        assetType.setTypeName("资产类型名称c" + LocalDateTime.now());
        assetType.setIsAutorecognize(true);
        assetTypeMapper.insert(assetType);
    }
}
